package com.cskaoyan.order.remote;

import com.cskaoyan.mall.commons.result.ResponseData;
import com.cskaoyan.mall.commons.result.ServiceCallResponse;
import com.cskaoyan.mall.dto.ClearCartItemRequest;
import com.cskaoyan.mall.dto.ClearCartItemServiceResponse;
import com.cskaoyan.mall.dto.ProductDetailDto;
import com.cskaoyan.mall.dto.ProductDetailServiceResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient("duolai-shopping")
public interface ProductApiClient {
    /**
     * 清空指定用户的购物车缓存(用户下完订单之后清理）
     */
    @DeleteMapping(value = "/rpc/cart/items")
    ClearCartItemServiceResponse clearCartItemByUserID(@RequestBody ClearCartItemRequest request);

    @DeleteMapping("shopping/carts/{uid}/{pid}")
    ResponseData deleleCart(@PathVariable("uid") Long uid, @PathVariable("pid") Long pid);

    @DeleteMapping("shopping/items/{uid}")
    ResponseData deleteCheckCart(@PathVariable("uid") Long uid);

    /*
        提供给订单服务查询指定商品信息(项目第二阶段才会用到)
     */
    @GetMapping(value = "/rpc/product/detail")
    ServiceCallResponse<ProductDetailDto> getProductDetail(@RequestParam("id") Long id);
}
